using System;
using System.Collections.Generic;

using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.UI;
using RevitGeo;

using Autodesk.Revit.DB.Events;

namespace RevitArchiFunctions
{
    public class TestMyStairExtendData
    {	
		static Guid %Class%ExdataGuid = new Guid("CC2ED575-3A5D-49AC-8924-12DE8011D0CA");

        void WriteExtendDataTo%Class%(ref Group %Class%Group)
        {
            if (%Class%Group == null) return;

            Schema schema = Schema.Lookup(%Class%ExdataGuid);
            if (schema == null)
            {
                SchemaBuilder schemaBuilder = new SchemaBuilder(%Class%ExdataGuid);
                schemaBuilder.SetSchemaName("%Class%ExtendedData");

                %VarsFunctionRevitInitExtendData%

                schema = schemaBuilder.Finish();
            }

            Entity entity = new Entity(schema);

            %VarsFunctionRevitWriteExtendData%

            %Class%Group.SetEntity(entity);
        }

        bool Read%Class%ExtendedData(Group %Class%Group)
        {
            if (%Class%Group == null) return false;

            Schema schema = Schema.Lookup(%Class%ExdataGuid);
            if (schema == null) return false;

            Entity entity = %Class%Group.GetEntity(schema);
            if (entity == null || entity.Schema == null) return false;

            %VarsFunctionRevitReadExtendData%
            return true;
        }
	}
}
